-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
solution #868
base: master
Are you sure you want to change the base?
solution #868
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, lets make some improve for it 1.https://www.loom.com/share/529f834e36fc442584eaabe4a92d5692
2. and check out all comments and review your code again on duplicate these mistakes
}; | ||
|
||
type UserIdType = { | ||
userId: User | null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why its called userId if its whole user
src/components/UserSelector.tsx
Outdated
const users = useContext(UserContext); | ||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
const userIdContext = useContext(UserIdContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in all components you need to destructure context obj
src/App.tsx
Outdated
const { isLoadingPosts } = useContext(ErrorContext); | ||
const { isError } = useContext(ErrorContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why its separate destructure? its can made in one
> | ||
<div className="tile is-child box is-success "> | ||
<PostDetails /> | ||
{postDetails.postData !== null && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also need to destracture postDetails
src/components/UserSelector.tsx
Outdated
const handleUserId | ||
= (userId: User) => { | ||
userIdContext.handleUserSelect(userId); | ||
handleMenu(); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const handleUserId | |
= (userId: User) => { | |
userIdContext.handleUserSelect(userId); | |
handleMenu(); | |
}; | |
const handleUserId = (userId: User) => { | |
userIdContext.handleUserSelect(userId); | |
handleMenu(); | |
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{user ? ( | ||
<span>{user.name}</span> | ||
) : ( | ||
<span>Choose a user</span> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{user ? ( | |
<span>{user.name}</span> | |
) : ( | |
<span>Choose a user</span> | |
)} | |
{user | |
? (<span>{user.name}</span> ) | |
: (<span>Choose a user</span>) | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEMO LINK